package com.ruoyi.ysg.service.impl;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.ysg.domain.YsgSetMeal;
import com.ruoyi.ysg.mapper.YsgSetMealMapper;
import com.ruoyi.ysg.service.IYsgSetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class YsgSetMealServiceImpl implements IYsgSetMealService {

    @Autowired
    private YsgSetMealMapper setMealMapper;
    @Override
    public List<YsgSetMeal> selectSetMealList(YsgSetMeal ysgSetMeal) {
        ysgSetMeal.setEffective(Constants.YES);
        return setMealMapper.getList(ysgSetMeal);
    }

    @Override
    public YsgSetMeal selectYsgSetMealById(Long id) {
        return setMealMapper.selectById(id);
    }

    @Override
    public int insertYsgSetMeal(YsgSetMeal ysgSetMeal) {
        ysgSetMeal.setEffective(Constants.YES);
        return setMealMapper.insert(ysgSetMeal);
    }

    @Override
    public int updateYsgSetMeal(YsgSetMeal ysgSetMeal) {
        return setMealMapper.update(ysgSetMeal);
    }

    @Override
    public int deleteYsgSetMealByIds(Long[] ids) {
        return setMealMapper.deleteByIds(ids);
    }

    @Override
    public int deleteYsgSetMealById(Long id) {
        return setMealMapper.deleteById(id);
    }

    @Override
    public List<YsgSetMeal> selectAvailableSetMealsByStudentId(Long studentId) {
        return setMealMapper.selectAvailableSetMealsByStudentId(studentId);
    }
}
